<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <style>
        @page {
            size: 279mm 200mm;
        }

        .head {
            width: 100%;
            height: 90px;
            text-align: center;
        }

        .head span {
            width: 100%;
            font-size: 30px;
            font-weight: 700;
            color: #333333;
            line-height: 41px;
            letter-spacing: 40px;

        }

        .headTable td {
            font-weight: bold;
        }

        .trMxTitle {
            font-size: 12px;
        }

        body {
            font-family: SimSun;
            font-size: 10px;
        }

        tr {
            /*height: 20px;*/
        }

        td {
            /*word-wrap: break-word;*/
            /*word-break: break-all;*/
        }

        .left {
            text-align: left;
        }

        .right {
            text-align: right;
        }

        .center {
            text-align: center;
        }

        .demo3 {
            border: 1px solid #1c1a1a;
            border-collapse: collapse;
        }

        .demo3 th, .demo3 td {
            border: 0.5px solid #1c1a1a;
            padding: 3px; /* 在单元格内部添加间距 */
        }

        .demo4 {
            border: 0px solid #1c1a1a;
            border-collapse: collapse;
        }

        .demo4 th, .demo4 td {
            border: 0px solid #1c1a1a;
            padding: 3px; /* 在单元格内部添加间距 */
        }
    </style>
</head>

<body>
<#escape x as x?html>
<#assign size=6>
<#if field_1?exists>

<#--计算所有明细合计-----begin----->
<#assign lineTotal=0>
<#list 0 .. field_1?size - 1 as i>
    <#assign data=field_1[i]>
    <#if data.Qty?exists>
        <#assign lineTotal +=data.Qty?number>
    </#if>
</#list>

<#--计算所有明细合计-----=end=----->

<#assign page=(field_1?size/size)?ceiling>
<#list 1..page as c>
<#if c*size gt field_1?size>
    <#assign end=field_1?size-1 />
<#else>
    <#assign end=c*size-1 />
</#if>

<div>
    <#if page=c>
    <div>
        <#else>
        <div style="page-break-after:always;">
            </#if>
            <table class="headTable" width="100%" border="0" cellspacing="0" cellpadding="0"
                   style=" line-height: 20px;">
                <colgroup>
                    <col/>
                    <col width="20%"/>
                    <col width="10%"/>
                    <col width="5%"/>
                    <col width="10%"/>
                    <col width="7%"/>
                </colgroup>
                <tbody>
                <tr>
                    <td colspan="6" class="head" style="text-align: center"><span>${YWZTMC!""}<br/>采购结算单</span>
                    </td>
                </tr>
                <tr>
                    <td colspan="6" style="text-align: right;">
                        ${c} /${page}
                    </td>
                </tr>
                <tr>
                    <td><b>供应商：${NAME1!""}</b></td>
                    <td colspan="2" style="text-align: center;"><b>货币：${WAERS!""}</b></td>
                    <td colspan="2" style="text-align: center;">
                        <b> 金额：</b>
                    </td>
                    <td style="text-align: right;">
                        <b> ${RMWWR!""}</b>
                    </td>
                </tr>
                <tr>
                    <td><b>发票号码：</b><b>${XBLNR!""}</b></td>
                    <td colspan="2"><b>凭证编码：</b><b>${LIFNR!""}</b></td>
                    <td colspan="2" style="text-align: center;">
                        <b>税额：</b>
                    </td>
                    <td style="text-align: right;">
                        <b>${WMWST1!""}</b>
                    </td>
                </tr>
                <tr>
                    <td width="33%"><span>文本：</span>${SGTXT!""}</td>
                    <td colspan="2"><b>凭证日期：</b><b>${BUDAT!""}</b></td>
                    <td colspan="3" style="text-align: left;">
                        &nbsp;&nbsp;&nbsp;&nbsp;<b>合同序号：</b>
                        <b>${ZUONR!""}</b>
                    </td>
                </tr>
                </tbody>
            </table>
            <div width="100%">
                <table width="100%" border="0.1" cellspacing="0" cellpadding="0" class="demo3">
                    <colgroup>
                        <col width="4%"/>
                        <col width="10%"/>
                        <col width="9%"/>
                        <col/>
                        <col width="8%"/>
                        <col width="6%"/>
                        <col width="9%"/>
                        <col width="10%"/>
                        <col width="9%"/>
                        <col width="10%"/>
                    </colgroup>
                    <thead>
                    <tr class="center trMxTitle" style="height: 45px;">
                        <td>项次</td>
                        <td>采购订单</td>
                        <td>物料编码</td>
                        <td>物料名称</td>
                        <td>库位</td>
                        <td>单位</td>
                        <td>数量</td>
                        <td>计划单价</td>
                        <td>单价</td>
                        <td>金额</td>
                    </tr>
                    </thead>
                    <tbody>
                    <#assign forLineHeight =60 />
                    <#assign lastLineNum = 0 />

                    <#list (c-1) * size..end as i>
                        <#assign data=field_1[i]>
                        <tr style="height: ${forLineHeight!""}px">
                            <td class="center">
                                <#if data.BUZEI?exists>
                                    <#assign tmpNumber = (data.BUZEI)?number >
                                    <#assign lastLineNum = tmpNumber >
                                    ${tmpNumber}
                                </#if>
                            </td>
                            <td>${data.EBELN!}</td>
                            <td>${data.MATNR!}</td>
                            <td>${data.MAKTX!}</td>
                            <td>${data.KW!}</td>
                            <td class="center">${data.BPRME!}</td>
                            <td class="right">${data.BPMNG!}</td>
                            <td class="right">${data.JHDJ!}</td>
                            <td class="right">${data.DJ!}</td>
                            <td class="right">${data.WRBTR!}</td>
                        </tr>
                    </#list>
                    <#assign lastPageMark = (c == page) />
                    <#if lastPageMark>
                        <!--==========================补充空行=============begin==========================-->
                        <#assign emptyLineNum = field_1?size - (c-1)*size />
                        <#if 0 != emptyLineNum>
                            <#list 1 .. (size - emptyLineNum) as i>
                                <tr style="height: ${forLineHeight!""}px">
                                    <td class="center">
                                        <#assign lastLineNum = lastLineNum + 1 >
                                        ${lastLineNum}
                                    </td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                </tr>
                            </#list>
                        </#if>
                        <!--==========================补充空行=============end ==========================-->
                    </#if>
                    </tbody>
                    <tr>
                        <td colspan="2" height="30px" class="center">
                            合计
                        </td>
                        <td colspan="4">
                        </td>
                        <td class="center">
                            ${HJSL!""}
                        </td>
                        <td colspan="2">

                        </td>
                        <td class="right">
                            ${RMWWR_HJ!""}
                        </td>
                    </tr>
                </table>
                <table border="0" cellspacing="0" cellpadding="0" width="100%" style="line-height: 13px;">
                    <colgroup>
                        <col width="55%"/>
                        <col width="45%"/>
                    </colgroup>
                    <tbody>
                    <tr style="height: 5px;">
                    </tr>
                    <tr>
                        <td style="text-align:left">出货单位</td>
                        <td style="text-align:left"></td>
                    </tr>
                    <tr>
                        <td style="text-align:left">及经手人：${JSR!""}</td>
                        <td style="text-align:left">制单人：${BKTXT!""}</td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    </#list>
    </#if>
    </#escape>
</body>

</html>